package com.matrix.java.chap_03;

import java.util.Scanner;

/*
    游戏：彩票猜三位数
 */
public class Ex3_15 {
    public static void main(String[] args) {
        int randomNum = (int) (Math.random() * 1000);
        int randomDigits = randomNum % 10;
        int randomTens = randomNum / 10 % 10;
        int randomHundreds = randomNum / 100;
        System.out.println(randomNum);
        Scanner input = new Scanner(System.in);
        System.out.print("输入: ");
        int num = input.nextInt();
        int digits = num % 10;
        int tens = num / 10 % 10;
        int hundreds = num / 100;
        if (digits == randomDigits && tens == randomTens && hundreds == randomHundreds) {
            System.out.println(10000);
        } else if ((hundreds == randomHundreds && tens == randomDigits && digits == randomTens)
                || (hundreds == randomTens && tens == randomHundreds && digits == randomDigits)
                || (hundreds == randomTens && tens == randomDigits && digits == randomHundreds)
                || (hundreds == randomDigits && tens == randomHundreds && digits == randomTens)
                || (hundreds == randomDigits && tens == randomTens && digits == randomHundreds)) {
            System.out.println(3000);
        } else if (hundreds == randomHundreds || hundreds == randomTens || hundreds == randomDigits
                || tens == randomHundreds || tens == randomTens || tens == randomDigits
                || digits == randomHundreds || digits == randomTens || digits == randomDigits) {
            System.out.println(1000);
        } else {
            System.out.println("none");
        }
    }
}
